package com.dtw.ditouwang.ui.mine;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.dtw.ditouwang.R;
import com.dtw.ditouwang.beans.NotifyBean;

import java.util.List;

public class SystemNotifyAdapter extends RecyclerView.Adapter<SystemNotifyAdapter.Holder> {
    private List<NotifyBean.DataBean> notifyBeanList;

    public SystemNotifyAdapter(List<NotifyBean.DataBean> notifyBeanList) {
        this.notifyBeanList = notifyBeanList;
    }

    @NonNull
    @Override
    public Holder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_notify_system, viewGroup, false));
    }

    @Override
    public void onBindViewHolder(@NonNull Holder holder, int i) {
        holder.time.setText(notifyBeanList.get(i).getTimes());
        holder.title.setText(notifyBeanList.get(i).getTitle());
        holder.content.setText(notifyBeanList.get(i).getContent());
    }

    @Override
    public int getItemCount() {
        return notifyBeanList.size();
    }

    class Holder extends RecyclerView.ViewHolder {
        TextView title, content,time;

        public Holder(@NonNull View itemView) {
            super(itemView);
            title = itemView.findViewById(R.id.text_title);
            content = itemView.findViewById(R.id.text_content);
            time = itemView.findViewById(R.id.text_time);
        }
    }
}
